import torch
from torch.nn import functional as F

X = torch.tensor([[1, 2],
                  [1, 3],
                  [2, 3],
                  [0, 1],
                  [3, 0]])
a = F.one_hot(X, 10)
# 输入为5*2相当于5个输入的样本，每个样本有俩个属性，10为词典的长度，这俩个属性扩展为10个one hot编码
print(a.shape)
print(a)